home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
fido
/
SHELTER275.lha
/
rexx
/
Read.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-04-17
|
7KB
|
232 lines
/**/
v="$VER: Read Rexx Message Base Browser Williamson 55.08"
tview="Extract"
/*tview="less -[cli]" */
bbslist="CFG:READ.CFG"
script="Multi-Network Reader";sv="v"||right(v,5)
cr='0a'x;lf='0a'x;NL='0d'x||'0a'x;cls='0C'x||'0A'x;quote='"'
log=show('p','ROOFLOG')
temp="ram:"
timeouts=0
if ~show("L", "rexxsupport.library") then
if ~addlib("rexxsupport.library", 0, -30, 0) then do
say "Couldn't access support.library !"
exit 20
end
if ~show("L", "rexxdossupport.library") then
if ~addlib("rexxdossupport.library", 0, -30, 2) then do
say "Couldn't access WB2 rexxdossupport.library !"
exit 20
end
options results
options failat 20
signal on halt
signal on ioerr
signal on break_c
signal on break_d
if arg()=0 then do
debug=1
username="Beta Tester"
end;else do
debug=0
baseport=GetClip('SHELTER')
if baseport="ROOF" then envpath="";else envpath=baseport"/"
auxdev=GetVar(envpath||'AUXDEV',"G")
auxmount=GetVar(envpath||'AUXMOUNT',"G")
devname=delstr(auxdev,pos(":",auxdev))
if ~showlist("H",devname) then do
options failat 99999
ADDRESS COMMAND auxmount
options failat 20
end
parse arg baud port username
Address VALUE baseport||port
'String $(device) $(unit) $(locked) $(baudlocked)'
parse var RESULT device unit locked baudlocked
if log then address 'ROOFLOG' 'logline' left(time(),5) script': REDIRECT:'device unit locked baudlocked
if locked="TRUE" then redirect=GetVar(envpath||'AUXDIRECT',"G")||strip(device)'/'strip(unit)'/con/shared/checkcd/speed'||strip(baudlocked)
else redirect=GetVar(envpath||'AUXDIRECT',"G")||strip(device)'/'strip(unit)'/con/shared/checkcd/speed'||strip(baud)
if log then address 'ROOFLOG' 'logline' left(time(),5) script': REDIRECT:'redirect
end
/* Start Area Processing */
if ~open('dlst',bbslist, 'R') then do
call send("SYSTEM ERROR: Couldn't open message areas list" bbslist||NL)
exit 10
end
x=upper(uprompt(' ANSI? (y/N) '))
ansi=x=="Y"
if ansi then do
CSI='1b'x||'[';AOFF=CSI||'0m';BOLD=CSI||'1m';ITALICS=CSI||'3;40m'
end;else do
CSI='';AOFF='';BOLD='';ITALICS=''
end
call send(cls||ITALICS||" "script sv||AOFF||NL||BOLD||" by Robert Williamson 1:167/104.0@fidonet"||AOFF||NL)
/* Start Area Processing */
call send(' Reading All Network Message Areas Configuration.')
area=1
do while ~eof('dlst')
call send('.')
ln=strip(readln('dlst'))
if ln="" then iterate
parse var ln Path.area Network.area Name.area
if Name.area="" then do
Name.area=get_fn(Path.area)
Network.area="FreeNet"
end;else do
Name.area=strip(Name.area)
Tag.area=get_fn(Path.area)
end
area=area+1
end /*eof*/
call close('dlst')
areas=area-1
call send(NL||' Found 'areas' message areas'||NL)
maincmd:
ucmd=uprompt(' Select Area Number, [L]ist areas, [Q]uit: ')
x=upper(left(ucmd,1))
if x="Q" then exit 0
else if datatype(ucmd,"N") & ucmd<areas+1 then do
call showarea(ucmd)
signal maincmd
end;else if x="L" then do
call send(cls)
display=1
do i=1 to areas
if length(i)=1 then call send(" "i" "ITALICS||Left_justify(Name.i,35)||AOFF||BOLD||left_justify(Tag.i,30)||AOFF||NL)
else call send(" "i" "||ITALICS||Left_justify(Name.i,35)||AOFF||BOLD||left_justify(Tag.i,30)||AOFF||NL)
display=display+1
if display>20 then do
ucmd=uprompt(' Select Area Number, [N]ext, [P]revious or [Q]uit: ')
if datatype(ucmd,"N") & ucmd<areas+1 then do
call showarea(ucmd)
signal maincmd
end
x=upper(left(ucmd,1))
if x="Q" then exit 0
else if x="N" | x="" then do
call send(cls)
display=1
end;else if x="P" then do
call send(cls)
if i>40 then i=i-40;else i=0
display=1
end;else do
call send('Invalid'||NL)
signal maincmd
end
end
end
signal maincmd
end
signal maincmd
exit 0
showarea:
area=arg(1)
path=addslash(Path.area)
call send(cls||' Scanning 'ITALICS||Network.area||AOFF' Area:'area BOLD||Name.area||AOFF)
x=showdir(Path.area,'F')
h=0
do i=1 to words(x)
nx=word(x,i)
if pos('.MSG',nx)=0 then iterate
parse var nx n '.MSG'
if n>h then h=n
end
drop x nx n
call Send(ITALICS||' Highest:'AOFF||BOLD||h||AOFF||NL)
gstart:
mstart=uprompt(' Enter Starting Message number or [Q}uit: ')
if upper(left(mstart,1))="Q" then return
if ~datatype(mstart,"N") then signal gstart
if mstart>h | ~exists(Path||mstart||'.MSG') then do
call send(' Cannot find message 'mstart', try again'NL)
signal gstart
end
gend:
mend=uprompt(' Enter Ending message or [Q]uit: ')
if upper(left(mend,1))="Q" then return
if ~datatype(mend,"N") then signal gend
if mend>h | ~exists(path||mend||'.MSG') then do
call send(' Cannot find message 'mend', highest is 'h||NL)
signal gend
end
if debug then cmd=tview Path' START 'mstart' END 'mend
else cmd=tview redirect Path' START 'mstart' END 'mend
address COMMAND cmd
if RC~=0 then signal gstart
return
send:
if debug then call writech(STDOUT,arg(1))
else do
'Print' quote||arg(1)||quote
'Send' quote||arg(1)||quote
end
return
uprompt:
if debug then do
options prompt arg(1)
parse pull x
return x
end;else do
'Print' quote||arg(1)||quote
'Send' quote||arg(1)||quote
'GetInbound E0 30'
'String $(event)'
if upper(RESULT)='CARRIER' then exit 10
else if upper(RESULT)='TIMEOUT' then do
timeouts=timeouts+1
if timeouts>3 then do
call send(' Sorry, too many timeouts, bye')
exit 10
end
end;else if upper(RESULT)='LOGIN' then do
'String $(namebuf)'
x=(RESULT)
end;else x=""
end
return x
get_fn:
if LastPos('/',arg(1))~=0 then return SubStr(arg(1),LastPos('/',arg(1))+1)
else if LastPos(':',arg(1))~=0 then return SubStr(arg(1),LastPos(':',arg(1))+1)
else return arg(1)
addslash:
curr=arg(1)
select
when right(curr, 1)=":" then nop
when right(curr, 1)="/" then nop
otherwise curr=curr"/"
end
return curr
/* a useful procedure by Walt Sullivan */
dequote:
parse arg thing
parse var thing '"' unq_thing '"'
if unq_thing ~= "" then return unq_thing
return thing
right_justify:
if length(arg(1))>arg(2) then return (right(arg(1),arg(2)))
else return (copies(" ",arg(2)-length(arg(1)))||arg(1))
left_justify:
if length(arg(1))>arg(2) then return (left(arg(1),arg(2)))
else return (arg(1)||copies(" ",arg(2)-length(arg(1))))
halt:
ioerr:
break_c:
break_d:
exit 10
/**/